//
//  DetailViewController.swift
//  MyNoteDemo4
//
//  Created by BZF on 2020/8/24.
//  Copyright © 2020 bzf. All rights reserved.
//

import UIKit

class DetailViewController: UIViewController {

    @IBOutlet weak var contentLabel: UILabel!
    @IBOutlet weak var dateLabel: UILabel!
    
    
    var detailItem: AnyObject?{
        
        //didSet说明：https://www.jianshu.com/p/fafc24262e1e
        didSet{
            self.configureView()
        }
    }
    
    func configureView(){
        if let note = self.detailItem as? Note{
            if let label = self.contentLabel{
                label.text = note.content
                dateLabel.text = note.date.description
            }
        }
    }
    
    override func viewDidLoad() {
        super.viewDidLoad()

        self.configureView()
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destination.
        // Pass the selected object to the new view controller.
    }
    */

}
